from todo_service import *

while True:
    todos = get_todos()
    for task_id, task in todos.items():
        print(f"{task_id}: {task}");
    
    action = input("请输入操作（add/delete/quit）：").strip().lower()
    if action == "add":
        task = input("请输入任务：")
        result = add(task)
        if result:
            print("任务添加成功！")
        else:
            print("任务添加失败！")
    elif action == "update":
        task_id = input("请输入任务ID：")
        task = input("请输入新的任务：")
        result = update(task_id, task)
        if result:
            print("任务更新成功！")
        else:
            print("任务更新失败！")
    elif action == "delete":
        task_id = input("请输入任务ID：")
        result = delete(task_id)
        if result:
            print("任务删除成功！")
        else:
            print("任务删除失败！")
    elif action == "quit":
        break
    else:
        print("无效的操作！")
        
